-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement PCZT support #440
Conversation
/// | ||
/// - This is chosen by the Constructor. | ||
/// - This is required by the IO Finalizer, and is cleared by it once used. | ||
/// - Signers MUST reject PCZTs that contain `dummy_sk` values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I both named this
dummy_sk
and added a "MUST reject" here because I do not want PCZTs to get serialized with non-dummy spending keys. - I stored the dummy note's
sk
instead of the smaller-scopedask
, because in Orchard we impose validity requirements at parse time ofsk
(specifically to ensure that a validivk
is produced), and we already had APIs for handling that parsing here. If desired this can be scoped down todummy_ask
, but given that (again) this field is only for dummy notes, I thinksk
should be fine here.
pub fn parse( | ||
actions: Vec<Action>, | ||
flags: u8, | ||
value_sum: (u64, bool), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided on this serialization format for ValueSum
(rather than e.g. i128
) because it has no edge cases; all values are valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK e7a2945 with minor questions / naming nits. Overall this looks excellent.
let (anchor, merkle_path) = { | ||
let cmx: ExtractedNoteCommitment = note.commitment().into(); | ||
let leaf = MerkleHashOrchard::from_cmx(&cmx); | ||
let mut tree = BridgeTree::<MerkleHashOrchard, u32, 32>::new(100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: since BridgeTree
is no longer being maintained, we should move away from using it.
|
||
/// Authorizing data for a bundle of actions that is just missing a binding signature. | ||
#[derive(Debug)] | ||
pub struct Unbound { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this name isn't particularly intuitive to me, but I don't have a better suggestion; maybe BindingSigInputs
or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name appears primarily in type signatures, i.e. Bundle<Unbound, ZatBalance>
; I chose it to make sense there (same as Authorized
/ Unauthorized
/ EffectsOnly
).
Force-pushed to address comments and add missing serialization APIs. |
Force-pushed to address another comment I missed. |
Force-pushed to address another comment I missed, and fix clippy lints. |
/// - `ephemeral_key` | ||
/// - `enc_ciphertext` | ||
/// - `out_ciphertext` | ||
pub(crate) encrypted_note: TransmittedNoteCiphertext, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to be transaction version-dependent, e.g. the length will change in NU6 due to ZIP 231 and also ZSAs. So do Output
and TransmittedNoteCiphertext
need to be version-dependent types, or is it sufficient for TransmittedNoteCiphertext
to contain a vector that is dynamically of the correct length?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the parsed typed type, so it can be whatever we want. The PCZT encoding uses Vec<u8>
for both ciphertexts in anticipation of NU7.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK cb404f8 with nonblocking question about how to handle TransmittedNoteCiphertext
in the future.
Co-authored-by: Daira-Emma Hopwood <[email protected]> Co-authored-by: Kris Nuttycombe <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-utACK d132b5b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc-only self-utACK 5b6cc68
No description provided.